Techniques for the verification of dynamically typed programs

نویسنده

  • Björn Engelmann
چکیده

Interpretation is the theoretical basis underlying most semantics-based program analyses. It was introduced by Cousot and Cousot [23] to provide a semantic foundation for program analysis. Essentially, one replaces the concrete program by an abstract model which can be feasibly analysed, a process which is called “abstraction”. While the program semantics (see Section 1.2.2) describes the program statement S as a transformer on (concrete) states σ1, σ2 ∈ Σ 〈S, σ1〉 ∗ → final〈σ2〉, abstract interpretation would model the same statement S in terms of abstract states σ̊1, σ̊2 ∈ Σ̊: S ` σ̊1 B σ̊2 In order to ensure soundness of the resulting analysis, care has to be taken that the abstraction safely approximates the program. We hence introduce a correctness relation R ⊆ Σ× Σ̊ such that σ1Rσ̊1 ∧ 〈S, σ1〉 ∗ → final〈σ2〉 ∧ S ` σ̊1 B σ̊2 ⇒ σ2Rσ̊2 holds for all statements S as well as all σ1, σ2 ∈ Σ, σ̊1, σ̊2 ∈ Σ̊. 1.4.2. Type Inference Type Inference is a program analysis with the goal of deriving sound and precise type information for a given program. We already defined a notion of types suitable for such an analyses in Section 1.3.1. To meet the requirements of abstract interpretation, we extend the previously defined set T of types to a complete lattice LT ∆ = (T ,⊆,>,⊥,∪,∩) with • T as our Abstract Domain of Union Types (represented as sets of class names), • The usual subset relation ⊆ as lattice pre-order (v), • T 3 > = C ∪ {Cnull} as largest lattice element, • T 3 ⊥ = {} as smallest lattice element, • t = ∪ (set-union) and u = ∩ (set-intersection) as join and meet operations respectively. As usual, we extend the lattice operations on our type domain pointwise for all σ̊ ∈ Σ̊ • σ̊ v σ̊′ ⇔ ∀x ∈ VL• σ̊(x) ⊆ σ̊′(x)∧∀@v ∈ VI • σ̊(self .@v) ⊆ σ̊′(self .@v)∧∀C ∈ C,@v ∈ VI • σ̊(C,@v) ⊆ σ̊′(C,@v).

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Closing the Gap - Formally Verifying Dynamically Typed Programs like Statically Typed Ones Using Hoare Logic - Extended Version -

Dynamically typed object-oriented languages enable programmers to write elegant, reusable and extensible programs. However, with the current methodology for program verification, the absence of static type information creates significant overhead. Our proposal is two-fold: First, we propose a layer of abstraction hiding the complexity of dynamic typing when provided with sufficient type informa...

متن کامل

Towards JavaScript Verification with the Dijkstra State Monad

Several special-purpose systems have been proposed to analyze programs in JavaScript and other dynamically typed languages. However, none of these prior systems support automated, modular verification for both higher-order and stateful features. This paper proposes a new refinement of the state monad, the Dijkstra state monad, as a way of structuring specifications for higher-order, stateful pr...

متن کامل

Monadic Refinement Types for Verifying JavaScript Programs

Researchers have developed several special-purpose type systems and program logics to analyze JavaScript and other dynamically typed programming languages. Still, no prior system can precisely reason about both higher-order programs and mutable state; each system comes with its own delicate soundness proof (when such proofs are provided at all); and tools based on these theories (when they exis...

متن کامل

A Sound and Complete Hoare Logic for Dynamically-Typed, Object-Oriented Programs - Extended Version -

A simple dynamically-typed, (purely) object-oriented language is defined. A structural operational semantics as well as a Hoarestyle program logic for reasoning about programs in the language in multiple notions of correctness are given. The Hoare logic is proved to be both sound and (relative) complete and is – to the best of our knowledge – the first such logic presented for a dynamically-typ...

متن کامل

Efficient Just-In-Time Execution of Dynamically Typed Languages Via Code Specialization Using Precise Runtime Type Inference

Dynamically typed languages such as JavaScript present a challenge to just-in-time compilers. In contrast to statically typed languages such as JVML, in which there are specific opcodes for common operations on primitive types (such as iadd for integer addition), all operations in dynamically typed language such as JavaScript are late-bound. Often enough, types cannot be inferred with certainty...

متن کامل

Object Encapsulation for Dynamically Typed Languages

Encapsulation mechanisms in object-oriented languages have traditionally been based on static type systems. As a consequence, dynamically-typed languages have only limited support for encapsulation. This is surprising, considering that encapsulation is one of the most fundamental and important concepts behind object-oriented programming and that it is essential for writing programs that are mai...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2017